package com.atguigu.mock.entity;

import com.atguigu.common.base.entity.AutoIdBase;
import com.atguigu.common.comment.Comment;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import java.math.BigDecimal;
import java.time.LocalDateTime;

@Entity
@Getter
@Setter
@NoArgsConstructor
@Comment("菜品规格表")
public class ProductSku extends AutoIdBase {
    @Comment("所属分类")
    @ManyToOne
    private ProductCategory productCategory;
    @Comment("所属菜品")
    @ManyToOne
    private ProductSpu productSpu;
    @Comment("规格名称")
    private String name;
    @Comment("价格")
    private BigDecimal price;

    public ProductSku(LocalDateTime createTime, ProductSpu productSpu, String name, BigDecimal price) {
        super(createTime);
        this.productCategory = productSpu.getProductCategory();
        this.productSpu = productSpu;
        this.name = name;
        this.price = price;
    }
}
